#include <stdio.h>
#include <algorithm>
#include <functional>

static unsigned short prices[20000];
int main()
{
    int T, t;
    scanf("%d", &T);
    for (t = 0; t < T; t++)
    {
        int n, i, sum = 0;
        scanf("%d", &n);
        for (i = 0; i < n; i++)
        {
            int p;
            scanf("%d", &p);
            prices[i] = p;
        }
        std::sort(prices + 0, prices + n, std::greater<unsigned short>());
        for (i = 2; i < n; i += 3)
            sum += prices[i];
        printf("%d\n", sum);
    }
    return 0;
}
